<?php
require_once APPPATH."controllers/cms_template.php";
class cms_news_template extends cms_template{
  	function __construct(){
   		parent::__construct();
   		$this->_template_type = 'news';
		$this->load->model('Model_newsgroup', 'model_newsgroup');
  	}
  /*
  function add(){
    $this->active_content = new Content();
    if($this->input->post('Submit')){
      $this->_request2Content($this->active_content);
      $this->active_content->setTemp($this->template_type);
      $this->active_content->save();
      redirect(site_url("?c=cmssitecontent&m=index{$this->go}"));
    }
    $this->_render_my_view(array());
  }
  function edit(){
  }
  function _request2Content($content){
    $content->setAttributes($_POST);
    return $content;
  }
  */
	function add($level = 1, $nav_id = 0){
		 if ($this->input->post('Submit')) {
			// Serialize t1
			$t1 = parse_input("t1_", $_POST);
			$_POST['item_t1'] = serialize($t1);
		 }
		 else{
		 	$this->_assign['newsgroups'] = $this->model_newsgroup->fetch_all();
		 }
		 return parent::add($level, $nav_id);
    }

    function edit($level = 1, $nav_id = 0, $id = 0){
    	if ($this->input->post('Submit')) {
			// Serialize t1
			$t1 = parse_input("t1_", $_POST);
			$_POST['item_t1'] = serialize($t1);
		 }
		 else{
		 	$this->_assign['newsgroups'] = $this->model_newsgroup->fetch_all();
		 }
		 parent::edit($level, $nav_id, $id);
    }
}
?>